
\documentclass{article}

\usepackage{ctex}
\usepackage{tikz}
\usepackage{adjustbox}
\usepackage{amsmath}
\usepackage{qtree} % 或 \usepackage{forest}
\usepackage{xcolor}

\usepackage{ifthen}
\usetikzlibrary{matrix, arrows.meta}
\usetikzlibrary{arrows.meta,positioning}
%\usetikzlibrary{chains, positioning}
\usetikzlibrary{shapes.multipart,calc}
%\usetikzlibrary{graphs,graphdrawing}
\usetikzlibrary{positioning}
\usetikzlibrary {datavisualization.formats.functions}
%\usegdlibrary{force}
%\usetikzlibrary {arrows.meta,graphs,graphdrawing}  
%\usegdlibrary {circular}
%\usetikzlibrary {arrows.meta,automata,positioning,shadows}

\tikzset{
	state/.style={
		state with output,
		minimum size=1cm,
		draw,
		align=center
	}
	
}

\newcommand{\checkOverlap}[3]{
	% #1: 新节点的x坐标，#2: 新节点的y坐标，#3: 节点名称
	\foreach \nodename in {q0,q1,...,#3}{
		\path let \p1 = (#1,#2), \p2 = (q\nodename) in
		\pgfextra{
			\pgfmathsetmacro{\checkOverlap}{veclen(\x1-\x2,\y1-\y2)}
			\ifdim\checkOverlap pt<1.5cm\relax
			\typeout{Overlap detected! Skipping node placement.}
			\breakforeach
			\fi
		};
	}
}

\newcommand{\redtext}[1]{\textcolor{red}{#1}}

\begin{document}
	%\chapter{位运算}

	% 位运算操作
	\input{01-bitOperation/bitOperation}
	
	%排序算法
	\input{04-sortedOperation/sortedOperation}
	% 链表
 	\input{03-linkedListOperation/linkedListOperation}
	% 树
	\input{02-treeOperation/treeOperation}
	%其他结构
	
	\input{05-graphOperation/graphOperation}
	
	% 递归
	\input{06-recursiveCode/recursiveCode}
	
	
\end{document}